import Vue from 'vue'
import VueRouter from 'vue-router'
Vue.use(VueRouter)

const routes = [
  {
    path: '',
    redirect: '/home',
    meta: { mainTabBar: true }
  },
  {
    path: '/home',
    name: 'Home',
    component: () => import('../views/home/Home.vue'),
    meta: { mainTabBar: true }
  },
  {
    path: '/cart',
    name: 'Cart',
    component: () => import('../views/cart/Cart.vue'),
    meta: { mainTabBar: true }
  },
  {
    path: '/category',
    name: 'Category',
    component: () => import('../views/category/Category.vue'),
    meta: { mainTabBar: true }
  },
  {
    path: '/profile',
    name: 'Profile',
    component: () => import('../views/profile/Profile.vue'),
    meta: { mainTabBar: true }
  },
  {
    path: '/detail/:iid',
    name: 'Detail',
    component: () => import('../views/detail/Detail.vue'),
    meta: { mainTabBar: false }
  },
]

const router = new VueRouter({
  // mode: 'history', // 需要后台配置
  base: process.env.BASE_URL,
  routes
})

export default router
